apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "controller" "app.kubernetes.io/name" "argocd-image-updater" "app.kubernetes.io/part-of" "argocd-image-updater" "app" "argocd-image-updater")) | nindent 2 }}
  name: argocd:image-updater
  namespace: d8-{{ .Chart.Name }}
rules:
  - apiGroups:
      - ""
    resources:
      - secrets
      - configmaps
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - argoproj.io
    resources:
      - applications
    verbs:
      - get
      - list
      - update
      - patch
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "controller" "app.kubernetes.io/name" "argocd-image-updater" "app.kubernetes.io/part-of" "argocd-image-updater" "app" "argocd-image-updater")) | nindent 2 }}
  name: argocd:image-updater
  namespace: d8-{{ .Chart.Name }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: argocd:image-updater
subjects:
  - kind: ServiceAccount
    name: argocd-image-updater
---
apiVersion: v1
kind: ServiceAccount
metadata:
  {{- include "helm_lib_module_labels" (list . (dict "app.kubernetes.io/component" "controller" "app.kubernetes.io/name" "argocd-image-updater" "app.kubernetes.io/part-of" "argocd-image-updater" "app" "argocd-image-updater")) | nindent 2 }}
  name: argocd-image-updater
  namespace: d8-{{ .Chart.Name }}
